<!-- HTML header for doxygen 1.8.20-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=9"/>
	<meta name="generator" content="Doxygen 1.9.4"/>
	<meta name="viewport" content="width=device-width, initial-scale=1"/>
	<title>Raspberry Pi Pico SDK: include/pico/sha256.h Source File</title>
	<!-- <link href="tabs.css" rel="stylesheet" type="text/css"/> -->
	<script type="text/javascript" src="jquery.js"></script>
	<script type="text/javascript" src="dynsections.js"></script>
	<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
	<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
	<link href="doxygen.css" rel="stylesheet" type="text/css" />
	<link href="normalise.css" rel="stylesheet" type="text/css"/>
<link href="main.css" rel="stylesheet" type="text/css"/>
<link href="styles.css" rel="stylesheet" type="text/css"/>
</head>
<body>
	<div class="navigation-mobile">
		<div class="logo--mobile">
			<a href="/"><img src="logo-mobile.svg" alt="Raspberry Pi"></a>
		</div>
		<div class="navigation-toggle">
			<span class="line-1"></span>
			<span class="line-2">
				<p>Menu Toggle</p>
			</span>
			<span class="line-3"></span>
		</div>
	</div>
	<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
		<div class="logo">
			<a href="index.html"> <img src="logo.svg" alt="Raspberry Pi"></a>
			<span style="display: inline-block; margin-top: 10px;">
				v2.1.0
			</span>
		</div>
		<div class="navigation-footer">
			<img src="logo-mobile.svg" alt="Raspberry Pi">
			<a href="https://www.raspberrypi.com/" target="_blank">By Raspberry Pi Ltd</a>
		</div>
<!-- 		<div class="search">
			<form>
				<input type="search" name="search" id="search" placeholder="Search">
				<input type="submit" value="Search">
			</form>
		</div> -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('rp2__common_2pico__sha256_2include_2pico_2sha256_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle"><div class="title">sha256.h</div></div>
</div><!--header-->
<div class="contents">
<a href="rp2__common_2pico__sha256_2include_2pico_2sha256_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span><span class="comment">/*</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno">    2</span><span class="comment"> * Copyright (c) 2024 Raspberry Pi (Trading) Ltd.</span></div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno">    3</span><span class="comment"> *</span></div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno">    4</span><span class="comment"> * SPDX-License-Identifier: BSD-3-Clause</span></div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno">    5</span><span class="comment"> */</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno">    6</span> </div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno">    7</span><span class="preprocessor">#ifndef _PICO_SHA256_H</span></div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span><span class="preprocessor">#define _PICO_SHA256_H</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span> </div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="preprocessor">#include &quot;<a class="code" href="common_2pico__time_2include_2pico_2time_8h.html">pico/time.h</a>&quot;</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span><span class="preprocessor">#include &quot;<a class="code" href="rp2__common_2hardware__dma_2include_2hardware_2dma_8h.html">hardware/dma.h</a>&quot;</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span><span class="preprocessor">#include &quot;<a class="code" href="rp2__common_2hardware__sha256_2include_2hardware_2sha256_8h.html">hardware/sha256.h</a>&quot;</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno">   13</span> </div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span><span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno">   43</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span> </div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"><a class="line" href="structpico__sha256__state.html">   48</a></span><span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code hl_struct" href="structpico__sha256__state.html">pico_sha256_state</a> {</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno">   49</span>    <span class="keyword">enum</span> <a class="code hl_enumeration" href="group__hardware__sha256.html#gaaf3089af3667088256de5d352973d5e6">sha256_endianness</a> endianness;</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno">   50</span>    int8_t channel;</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno">   51</span>    <span class="keywordtype">bool</span> locked;</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno">   52</span>    uint8_t cache_used;</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno">   53</span>    <span class="keyword">union </span>{</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno">   54</span>        uint32_t word;</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span>        uint8_t bytes[4];</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno">   56</span>    } cache;</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno">   57</span>    <a class="code hl_struct" href="structdma__channel__config.html">dma_channel_config</a> config;</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span>    <span class="keywordtype">size_t</span> total_data_size;</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"><a class="line" href="group__pico__sha256.html#gadb68f9eb89ce1a5b795463cd083a30a0">   59</a></span>} <a class="code hl_typedef" href="group__pico__sha256.html#gadb68f9eb89ce1a5b795463cd083a30a0">pico_sha256_state_t</a>;</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno">   60</span> </div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span><span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__sha256.html#ga56a125e51ec616f61082cc63c8599dcb">pico_sha256_try_start</a>(<a class="code hl_struct" href="structpico__sha256__state.html">pico_sha256_state_t</a> *state, <span class="keyword">enum</span> <a class="code hl_enumeration" href="group__hardware__sha256.html#gaaf3089af3667088256de5d352973d5e6">sha256_endianness</a> endianness, <span class="keywordtype">bool</span> use_dma);</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span> </div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno">   86</span><span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__sha256.html#ga6e6d3e0a3cb87e32a73757bcda88ebc1">pico_sha256_start_blocking_until</a>(<a class="code hl_struct" href="structpico__sha256__state.html">pico_sha256_state_t</a> *state, <span class="keyword">enum</span> <a class="code hl_enumeration" href="group__hardware__sha256.html#gaaf3089af3667088256de5d352973d5e6">sha256_endianness</a> endianness, <span class="keywordtype">bool</span> use_dma, <a class="code hl_typedef" href="group__timestamp.html#ga8b7f3d602cc053f05bacceeacc257ed8">absolute_time_t</a> until);</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno">   87</span> </div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"><a class="line" href="group__pico__sha256.html#gaf8fdc6d7438ffed9fcbc124eb134ae6e">   99</a></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code hl_function" href="group__pico__sha256.html#gaf8fdc6d7438ffed9fcbc124eb134ae6e">pico_sha256_start_blocking</a>(<a class="code hl_struct" href="structpico__sha256__state.html">pico_sha256_state_t</a> *state, <span class="keyword">enum</span> <a class="code hl_enumeration" href="group__hardware__sha256.html#gaaf3089af3667088256de5d352973d5e6">sha256_endianness</a> endianness, <span class="keywordtype">bool</span> use_dma) {</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno">  100</span>    <span class="keywordflow">return</span> <a class="code hl_function" href="group__pico__sha256.html#ga6e6d3e0a3cb87e32a73757bcda88ebc1">pico_sha256_start_blocking_until</a>(state, endianness, use_dma, <a class="code hl_variable" href="group__timestamp.html#gab375b40e949dce1052298f79c66f7120">at_the_end_of_time</a>);</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno">  101</span>}</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno">  102</span> </div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno">  118</span><span class="keywordtype">void</span> <a class="code hl_function" href="group__pico__sha256.html#ga43c112e22aea468ce0551c5078e155cd">pico_sha256_update</a>(<a class="code hl_struct" href="structpico__sha256__state.html">pico_sha256_state_t</a> *state, <span class="keyword">const</span> uint8_t *data, <span class="keywordtype">size_t</span> data_size_bytes);</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno">  119</span> </div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno">  133</span><span class="keywordtype">void</span> <a class="code hl_function" href="group__pico__sha256.html#ga9bf8472019386229c3ba3b6d169b9656">pico_sha256_update_blocking</a>(<a class="code hl_struct" href="structpico__sha256__state.html">pico_sha256_state_t</a> *state, <span class="keyword">const</span> uint8_t *data, <span class="keywordtype">size_t</span> data_size_bytes);</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno">  134</span> </div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno">  144</span><span class="keywordtype">void</span> <a class="code hl_function" href="group__pico__sha256.html#ga4eac54bf699dba0067a22ae3ef5ae121">pico_sha256_finish</a>(<a class="code hl_struct" href="structpico__sha256__state.html">pico_sha256_state_t</a> *state, <a class="code hl_union" href="unionsha256__result__t.html">sha256_result_t</a> *out);</div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno">  145</span> </div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno">  146</span><span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno">  147</span>}</div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno">  148</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno">  149</span> </div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno">  150</span><span class="preprocessor">#endif</span></div>
<div class="ttc" id="acommon_2pico__time_2include_2pico_2time_8h_html"><div class="ttname"><a href="common_2pico__time_2include_2pico_2time_8h.html">time.h</a></div></div>
<div class="ttc" id="agroup__hardware__sha256_html_gaaf3089af3667088256de5d352973d5e6"><div class="ttname"><a href="group__hardware__sha256.html#gaaf3089af3667088256de5d352973d5e6">sha256_endianness</a></div><div class="ttdeci">sha256_endianness</div><div class="ttdoc">SHA-256 endianness definition used in the API.</div><div class="ttdef"><b>Definition:</b> sha256.h:49</div></div>
<div class="ttc" id="agroup__pico__sha256_html_ga43c112e22aea468ce0551c5078e155cd"><div class="ttname"><a href="group__pico__sha256.html#ga43c112e22aea468ce0551c5078e155cd">pico_sha256_update</a></div><div class="ttdeci">void pico_sha256_update(pico_sha256_state_t *state, const uint8_t *data, size_t data_size_bytes)</div><div class="ttdoc">Add byte data to be SHA-256 calculation.</div><div class="ttdef"><b>Definition:</b> sha256.c:137</div></div>
<div class="ttc" id="agroup__pico__sha256_html_ga4eac54bf699dba0067a22ae3ef5ae121"><div class="ttname"><a href="group__pico__sha256.html#ga4eac54bf699dba0067a22ae3ef5ae121">pico_sha256_finish</a></div><div class="ttdeci">void pico_sha256_finish(pico_sha256_state_t *state, sha256_result_t *out)</div><div class="ttdoc">Finish the SHA-256 calculation and return the result.</div><div class="ttdef"><b>Definition:</b> sha256.c:167</div></div>
<div class="ttc" id="agroup__pico__sha256_html_ga56a125e51ec616f61082cc63c8599dcb"><div class="ttname"><a href="group__pico__sha256.html#ga56a125e51ec616f61082cc63c8599dcb">pico_sha256_try_start</a></div><div class="ttdeci">int pico_sha256_try_start(pico_sha256_state_t *state, enum sha256_endianness endianness, bool use_dma)</div><div class="ttdoc">Start a SHA-256 calculation returning immediately with an error if the SHA-256 hardware is not availa...</div><div class="ttdef"><b>Definition:</b> sha256.c:33</div></div>
<div class="ttc" id="agroup__pico__sha256_html_ga6e6d3e0a3cb87e32a73757bcda88ebc1"><div class="ttname"><a href="group__pico__sha256.html#ga6e6d3e0a3cb87e32a73757bcda88ebc1">pico_sha256_start_blocking_until</a></div><div class="ttdeci">int pico_sha256_start_blocking_until(pico_sha256_state_t *state, enum sha256_endianness endianness, bool use_dma, absolute_time_t until)</div><div class="ttdoc">Start a SHA-256 calculation waiting for a defined period for the SHA-256 hardware to be available.</div><div class="ttdef"><b>Definition:</b> sha256.c:59</div></div>
<div class="ttc" id="agroup__pico__sha256_html_ga9bf8472019386229c3ba3b6d169b9656"><div class="ttname"><a href="group__pico__sha256.html#ga9bf8472019386229c3ba3b6d169b9656">pico_sha256_update_blocking</a></div><div class="ttdeci">void pico_sha256_update_blocking(pico_sha256_state_t *state, const uint8_t *data, size_t data_size_bytes)</div><div class="ttdoc">Add byte data to be SHA-256 calculation.</div><div class="ttdef"><b>Definition:</b> sha256.c:141</div></div>
<div class="ttc" id="agroup__pico__sha256_html_gadb68f9eb89ce1a5b795463cd083a30a0"><div class="ttname"><a href="group__pico__sha256.html#gadb68f9eb89ce1a5b795463cd083a30a0">pico_sha256_state_t</a></div><div class="ttdeci">struct pico_sha256_state pico_sha256_state_t</div><div class="ttdoc">SHA-256 state used by the API.</div></div>
<div class="ttc" id="agroup__pico__sha256_html_gaf8fdc6d7438ffed9fcbc124eb134ae6e"><div class="ttname"><a href="group__pico__sha256.html#gaf8fdc6d7438ffed9fcbc124eb134ae6e">pico_sha256_start_blocking</a></div><div class="ttdeci">static int pico_sha256_start_blocking(pico_sha256_state_t *state, enum sha256_endianness endianness, bool use_dma)</div><div class="ttdoc">Start a SHA-256 calculation, blocking forever waiting until the SHA-256 hardware is available.</div><div class="ttdef"><b>Definition:</b> sha256.h:99</div></div>
<div class="ttc" id="agroup__timestamp_html_ga8b7f3d602cc053f05bacceeacc257ed8"><div class="ttname"><a href="group__timestamp.html#ga8b7f3d602cc053f05bacceeacc257ed8">absolute_time_t</a></div><div class="ttdeci">uint64_t absolute_time_t</div><div class="ttdoc">An opaque 64 bit timestamp in microseconds.</div><div class="ttdef"><b>Definition:</b> types.h:43</div></div>
<div class="ttc" id="agroup__timestamp_html_gab375b40e949dce1052298f79c66f7120"><div class="ttname"><a href="group__timestamp.html#gab375b40e949dce1052298f79c66f7120">at_the_end_of_time</a></div><div class="ttdeci">const absolute_time_t at_the_end_of_time</div><div class="ttdoc">The timestamp representing the end of time; this is actually not the maximum possible timestamp,...</div></div>
<div class="ttc" id="arp2__common_2hardware__dma_2include_2hardware_2dma_8h_html"><div class="ttname"><a href="rp2__common_2hardware__dma_2include_2hardware_2dma_8h.html">dma.h</a></div></div>
<div class="ttc" id="arp2__common_2hardware__sha256_2include_2hardware_2sha256_8h_html"><div class="ttname"><a href="rp2__common_2hardware__sha256_2include_2hardware_2sha256_8h.html">sha256.h</a></div></div>
<div class="ttc" id="astructdma__channel__config_html"><div class="ttname"><a href="structdma__channel__config.html">dma_channel_config</a></div><div class="ttdef"><b>Definition:</b> dma.h:149</div></div>
<div class="ttc" id="astructpico__sha256__state_html"><div class="ttname"><a href="structpico__sha256__state.html">pico_sha256_state</a></div><div class="ttdoc">SHA-256 state used by the API.</div><div class="ttdef"><b>Definition:</b> sha256.h:48</div></div>
<div class="ttc" id="aunionsha256__result__t_html"><div class="ttname"><a href="unionsha256__result__t.html">sha256_result_t</a></div><div class="ttdoc">SHA-256 result generated by the API.</div><div class="ttdef"><b>Definition:</b> sha256.h:57</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->

	<script src="main.js"></script>
</body>
</html>